home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-04-08 | 7.4 KB | 261 lines | [TEXT/MPS ] |
- { UNothing.p}
- { Copyright © 1990, 1991 by Apple Computer, Inc. All rights reserved.}
-
- { Original code by: Kurt Schmucker (KJS).
- Modified by: Geoff Pascoe (GAP).
-
- Change List:
-
- ddmmyy
- GAP 060990 Modified USES when changing from Lightspeed Pascal to MPW.
- GAP 181290 Added more comments.
- GAP 110190 TTrackingView is now a subclass of TView.
- GAP 110190 TCGridView is now TCGridView1 and a subclass of TReleifGridView.
- GAP 110190 TCGridView1.GetComponentTracker and TCGridView1.PlaceComponent
- are no longer overrides.
- GAP 110190 Cleaned up some comments.
- GAP 110191 Added sense parameter to PlaceComponent methods to indicate whether this
- is a placement (TRUE) or an undo of a placement (FALSE).
- GAP 110191 Changed PlaceComponent methods from FUNCTIONS to PROCEDURES.
- GAP 110191 Removed fOldComponentNumber instance variable from TComponentTracker
- and put it in TCGridView1.
- GAP 170191 Changed IComponentTracker to take a generic TView as its first argument
- as apposed to a TTrackingView.
- GAP 170191 Changed TComponentTracker instance variable fTrackingView:TTrackingView to
- fTrackingView:TView.
- GAP 180191 Added TCGridView2 class.
- GAP 180191 Removed argument from ICGridView1 and ICGridView2.
- GAP 180191 Removed kCGridWindowResID and dded kCGridWindow1ResID
- and kCGridWindow2ResID.
- GAP 250191 Added new data type, ComponentPlacementSense, that is now the type
- of the sense paramater in PlaceComponent.
- GAP 190291 Added fTrackingWindow instance variable to TComponentTracker.
- GAP 020491 Massive changes for latest version using UIconDragging unit.
-
-
- End Change List. }
-
- UNIT UNothing;
-
- { This program demonstrates how to track on the desktop from one view to another. }
-
-
- INTERFACE
-
-
- USES
-
- { Required for this unit's interface }
- Packages,
-
- { MacApp }
- UMacApp,
-
- { Standard MacApp Building Blocks }
- UPrinting,
- UGridView,
-
- { Other Building Blocks }
- UReliefGridView,
- UOSBitmap,
- UOSImage,
- UIconDragging;
-
- CONST
-
- { Signatures and Types }
- kSignature = 'SS01';
- kFileType = 'SF01';
-
- { CIcon Id's }
- kDaffy1Icon = 801;
- kBugsIcon = 802;
- kSylvesterIcon = 803;
- kTweetyIcon = 804;
- kDaffy2Icon = 805;
- kDevilIcon = 806;
- kFoghornIcon = 807;
- kOscarIcon = 901;
- kHobbsIcon = 902;
- kCalvinIcon = 903;
- kYinYangIcon = 904;
- kMoofIcon = 905;
-
- { View constants and id's }
- kLooneyWindow1ResID = 2001;
- kLooneyWindow2ResID = 2002;
- kLooneyViewID = 'lgrd';
-
- { Miscellaneous constants }
- kNumberOfRows = 5;
- kNumberOfColumns = 2;
- kMaxLooneys = kNumberOfRows * kNumberOfColumns;
-
- TYPE
-
- Looney = CIconHandle;
-
- LooneyNumber = IconNumber;
-
- LooneyRange = 1..kMaxLooneys;
-
- LooneyPlacementSense = IconPlacementSense;
-
-
- { The LooneyApplication }
-
- TLooneyApplication = OBJECT(TApplication)
-
- PROCEDURE TLooneyApplication.ILooneyApplication (itsMainFileType: OSType);
-
- PROCEDURE TLooneyApplication.Fields (PROCEDURE DoToField (fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: INTEGER));
- OVERRIDE;
-
- FUNCTION TLooneyApplication.DoMakeDocument (itsCmdNumber: cmdNumber): TDocument;
- OVERRIDE;
-
- END; {TLooneyApplication}
-
-
- { The TLooneyDocument controls a TLooneyView1 or TLooneyView2. Both
- are needed to demonstrate that icons can be dragged between two
- views not of the same class. }
-
- TLooneyDocument = OBJECT(TDocument)
-
- PROCEDURE TLooneyDocument.ILooneyDocument;
-
- PROCEDURE TLooneyDocument.Fields (PROCEDURE DoToField (fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: INTEGER));
- OVERRIDE;
-
- PROCEDURE TLooneyDocument.DoMakeViews (forPrinting: BOOLEAN);
- OVERRIDE;
-
- END; {TLooneyDocument}
-
-
- { A TLooneyView1 ia a ReliefGridView that displays icons/Looneys
- and allows moving tracking on desktop and between views. It starts
- up displaying Looney Tunes characters but is otherwise identical to
- TLooneyView2. }
-
- TLooneyView1 = OBJECT(TReliefGridView)
-
- fOldLooneyNumber: LooneyNumber; { The Looney we replaced in a PlaceLooney- used for undo. }
- fLooneyNumbers: ARRAY[LooneyRange] OF LooneyNumber; { The Looney numbers for Looneys in this view. }
-
- PROCEDURE TLooneyView1.ILooneyView1;
-
- PROCEDURE TLooneyView1.Fields (PROCEDURE DoToField (fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: INTEGER));
- OVERRIDE;
-
- FUNCTION TLooneyView1.DoMouseCommand (VAR theMouse: Point;
- VAR info: EventInfo;
- VAR hysteresis: Point): TCommand;
- OVERRIDE;
-
- PROCEDURE TLooneyView1.DrawCell (aCell: GridCell; aQDRect: Rect);
- OVERRIDE;
-
- PROCEDURE TLooneyView1.PlotMyIcon (aCell: GridCell; aQDRect: Rect);
-
- PROCEDURE TLooneyView1.PlotMyText (aCell: GridCell; aQDRect: Rect);
-
- FUNCTION TLooneyView1.GetIndexFromCell (aCell: GridCell): INTEGER;
-
- FUNCTION TLooneyView1.GeTLooneyPlacer (aLooneyNumber: LooneyNumber;
- offset: Point): TLooneyPlacer;
-
- PROCEDURE TLooneyView1.PlaceLooney (aLooneyNumber: LooneyNumber;
- aVPoint: VPoint;
- sense: LooneyPlacementSense);
-
- END; {TLooneyView1}
-
-
- { A TLooneyView1 ia a ReliefGridView that displays icons/Looneys
- and allows moving tracking on desktop and between views. It starts
- up displaying other cartoon characters but is otherwise identical to
- TLooneyView1. }
-
- TLooneyView2 = OBJECT(TReliefGridView)
-
- fOldLooneyNumber: LooneyNumber; { The Looney we replaced in a PlaceLooney- used for undo. }
- fLooneyNumbers: ARRAY[LooneyRange] OF LooneyNumber; { The Looney numbers for Looneys in this view. }
-
- PROCEDURE TLooneyView2.ILooneyView2;
-
- PROCEDURE TLooneyView2.Fields (PROCEDURE DoToField (fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: INTEGER));
- OVERRIDE;
-
- FUNCTION TLooneyView2.DoMouseCommand (VAR theMouse: Point;
- VAR info: EventInfo;
- VAR hysteresis: Point): TCommand;
- OVERRIDE;
-
- PROCEDURE TLooneyView2.DrawCell (aCell: GridCell; aQDRect: Rect);
- OVERRIDE;
-
- PROCEDURE TLooneyView2.PlotMyIcon (aCell: GridCell; aQDRect: Rect);
-
- PROCEDURE TLooneyView2.PlotMyText (aCell: GridCell; aQDRect: Rect);
-
- FUNCTION TLooneyView2.GetIndexFromCell (aCell: GridCell): INTEGER;
-
- FUNCTION TLooneyView2.GeTLooneyPlacer (aLooneyNumber: LooneyNumber;
- offset: Point): TLooneyPlacer;
-
- PROCEDURE TLooneyView2.PlaceLooney (aLooneyNumber: LooneyNumber;
- aVPoint: VPoint;
- sense: LooneyPlacementSense);
-
- END; {TLooneyView2}
-
-
- { Tracks a Looney and allows placement in TTrackingViews. }
-
- TLooneyPlacer = OBJECT(TPlaceByNumber)
-
- PROCEDURE TLooneyPlacer.ILooneyPlacer (aTrackingView: TView;
- offset: Point;
- aLooneyNumber: LooneyNumber);
-
- PROCEDURE TLooneyPlacer.Fields (PROCEDURE DoToField (fieldName: Str255;
- fieldAddr: Ptr;
- fieldType: integer));
- OVERRIDE;
-
- { Actions }
- PROCEDURE TLooneyPlacer.DoIt;
- OVERRIDE;
-
- PROCEDURE TLooneyPlacer.UndoIt;
- OVERRIDE;
-
- PROCEDURE TLooneyPlacer.RedoIt;
- OVERRIDE;
-
- END; {TLooneyPlacer}
-
-
- { ::::::::::::::::::::::: Globals ::::::::::::::::::::::: }
-
-
- VAR
- gLooneyApplication: TLooneyApplication; { Global representing the only TLooneyApplication object }
- gLooneyPaletteFlag: BOOLEAN; { Determines with of two palettes is created- it alternates }
-
-
- IMPLEMENTATION
-
- {$I $$Shell(SrcApp)UNothing.inc1.p}
-
- END. {UNothing}